package com.example.graduationdesignbackend.controller;


import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckRole;
import com.example.graduationdesignbackend.entity.Info;
import com.example.graduationdesignbackend.enums.InfoType;
import com.example.graduationdesignbackend.res.Res;
import com.example.graduationdesignbackend.service.IInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yuze
 * @since 2024-04-07
 */
@RestController
@SaCheckLogin
@SaCheckRole("super-admin")
@RequestMapping("/info")
public class InfoController {
  @Autowired
  private IInfoService infoService;

  @GetMapping()
  public Res<Info> getInfo(InfoType type){
    return Res.yuze(infoService.getInfo(type));
  }

  @PutMapping()
  public void editInfo(@RequestBody Info info){ infoService.edit(info);}
}
